import React from 'react';
import { View, Text, Button } from 'react-native';
import service from '@/config/service'
import storge from  '@/utils/storge'


export default class Home extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            mmp: 0
        }
    }
    UNSAFE_componentWillMount = () => {
        service.userLogin({
            userName: 'admin',
            password: 321
        }).then(res => {
            storge.setValue('token', res.token)
        }).catch(err => {
            console.log(err);
        })
    }
    onPress = () => {
        // const { navigation } = this.props
        service.getAreaList(1, 1000 ,'')
        .then(res => {
            console.log(res);
        })
        .catch(err => {
            console.log(err);
        })
    
    }
    render() {
        return (
            <View>
                <Text>Home</Text>
                <Text>{ this.state.mmp }</Text>
                <Button title="go" onPress={this.onPress}></Button>
            </View>
        )
    }
}
 